<template>
  <div class="home">
    <!-- 1. 顶部英雄区域 -->
    <section class="hero">
      <div class="video-container" v-show="isVideoPlaying && !isPipMode">
        <video ref="video" src="/src/assets/video/home.m4v" class="hero__video" controls loop
          @enterpictureinpicture="isPipMode = true"
          @leavepictureinpicture="isPipMode = false"></video>
        <button class="exit-button" @click="exitVideo">×</button>
      </div>
      <div class="hero__content" v-show="!isVideoPlaying || isPipMode">
        <h1 class="hero__title">Spanning the river of time</h1>
        <p class="hero__subtitle">横 跨 时 间 之 河</p>
        <div class="hero__buttons">
          <button class="btn btn--outline" @click="playVideo">探索生命美学</button>
        </div>
      </div>
    </section>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const isVideoPlaying = ref(false);
const isPipMode = ref(false);
const video = ref(null);

const playVideo = () => {
  if (isPipMode.value) {
    return;
  }
  isVideoPlaying.value = true;
  video.value.play();
}

const exitVideo = () => {
  isVideoPlaying.value = false;
  video.value.pause();
  video.value.currentTime = 0;
}
</script>

<style scoped lang="scss">
.home {
  overflow: hidden;
  height: calc(100vh - 114px);
}

.video-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.exit-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 24px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  
  &:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
  }
}

.hero__video {
  width: 100%;
  height: 100%;
  background-color: #000;
}

@keyframes rotate {
	100% {
		transform: rotate(1turn);
	}
}

@keyframes rotate {
	100% {
		transform: rotate(1turn);
	}
}

.conic {
	position: relative;
	z-index: 0;
	width: 250px;
	height: 72px;
	border-radius: 50px;
	overflow: hidden;
  border: 2px solid #fff;
  opacity: 0.5;
  padding: 20px;
	
	&::before {
		content: '';
		position: absolute;
		z-index: -2;
		left: -50%;
		top: -150%;
		width: 200%;
		height: 400%;
		// background-color: #1a232a;
		background-repeat: no-repeat;
		background-position: 0 0;
		background-image: conic-gradient(transparent, rgb(255, 255, 255), transparent 30%);
		animation: rotate 4s linear infinite;
	}
	
	&::after {
		content: '';
		position: absolute;
		z-index: -1;
		left: 2px;
		top: 2px;
		width: calc(100% - 4px);
		height: calc(100% - 4px);
		border-radius: 5px;
	}
}


.hero__title {
  width: 100%;
}

.banner {
  width: 100%;
  max-width: 1920px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 67px;
  padding: 0 40px;
}

.menu-btn {
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

.menu-icon {
  display: inline-block;
  width: 18px;
  height: 14px;
  border-top: 2px solid #333;
  border-bottom: 2px solid #333;
  position: relative;
  margin-right: 8px;
}

.menu-icon::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 2px;
  background-color: #333;
  top: 50%;
  transform: translateY(-50%);
}

.logo-container {
  text-align: center;
}

.logo {
  height: 30px;
}

.search-container {
  position: relative;
}

.search-input {
  border: none;
  border-bottom: 1px solid #ddd;
  background-color: transparent;
  padding: 5px 10px;
  font-size: 14px;
  width: 120px;
}

.category-nav {
  display: flex;
  justify-content: center;
  padding: 10px 0;
  border-top: 1px solid #eee;
}

.category-item {
  padding: 0 20px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
}

.category-item:hover {
  color: #333;
}

/* 英雄区域 */
.hero {
  height: 100%;
  background-image: url('/src/assets/images/banner.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.2);
}

.hero__content {
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
  color: #fff;
}

.hero__title {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.hero__subtitle {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  letter-spacing: 36px;
}

.hero__buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 0 auto;
  margin-top: 4rem;
  padding: 2px;
  border: none;

  &:hover {
    &::before {
      animation: none;
      background-image: none;
      background-color: rgba(255, 255, 255, 0.8);
    }
  }
}

.btn {
  // display: inline-block;
  // padding: 0.8rem 2rem;
    width: 248px;
    height: 72px;
    border: 1px solid #fff;
    position: relative;
    border-radius: 50px;
    /* z-index: 18; */
    cursor: pointer;
    color: #fff;
    background-color: rgba(255, 255, 255, .3);
    font-size: 18px;
  // font-weight: 500;
  // text-align: center;
  // transition: var(--transition);
}

.btn--primary {
  background-color: var(--primary-color);
  color: #fff;
}


.btn--light {
  background-color: #fff;
  color: var(--primary-color);
}

// .btn:hover {
//   transform: translateY(-3px);
//   box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
// }

/* 通用部分 */
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background-color: var(--primary-color);
}

.section-subtitle {
  font-size: 1.2rem;
  color: #777;
  max-width: 600px;
  margin: 0 auto;
}

/* 晶体展示 */
.crystal-showcase {
  padding: 5rem 0;
  background-color: #fff;
}

.crystal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.crystal-item {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

.crystal-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.crystal-image {
  height: 250px;
  overflow: hidden;
}

.crystal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.crystal-item:hover .crystal-image img {
  transform: scale(1.05);
}

.crystal-info {
  padding: 1.5rem;
}

.crystal-info h3 {
  margin-bottom: 0.8rem;
  color: var(--primary-color);
}

.crystal-info p {
  color: #666;
  line-height: 1.6;
}

/* 黑色晶体区 */
.black-crystal {
  padding: 5rem 0;
  background-color: var(--dark-color);
  background-image: url('');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

.black-crystal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
}

.black-crystal__content {
  text-align: center;
  color: #fff;
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin: 0 auto;
}

.black-crystal__title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.black-crystal__text {
  margin-bottom: 2rem;
  font-size: 1.2rem;
  opacity: 0.9;
}

/* 艺术展示区 */
.art-show {
  padding: 5rem 0;
  background-color: var(--light-color);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.art-item {
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

.art-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.art-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.art-info {
  padding: 1.5rem;
}

.art-title {
  margin-bottom: 0.8rem;
  font-size: 1.3rem;
}

.art-description {
  color: #666;
  line-height: 1.6;
}

/* 北极艺术展 */
.arctic-show {
  padding: 5rem 0;
  background-image: url('');
  background-size: cover;
  background-position: center;
  position: relative;
}

.arctic-show::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
}

.arctic-show__content {
  text-align: center;
  color: #fff;
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin: 0 auto;
}

.arctic-show__title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.arctic-show__date {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.arctic-show__location {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* 响应式 */
@media (max-width: 768px) {
  .hero__title {
    font-size: 2.5rem;
  }
  
  .hero__subtitle {
    font-size: 1.2rem;
  }
  
  .hero__buttons {
    width: 250px;
    height: 72px;
    margin: 0 auto;
  }
  
  .section-title {
    font-size: 2rem;
  }
}
</style> 